﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace kongjian37
{
    [Designer(typeof(TongJi_EMS._TJ_Basic.TJ_BasicControlDesigner))]
    public partial class duanluqi35kv : TongJi_EMS._TJ_Basic.TJ_BasicControl
    {
        public duanluqi35kv()
        {
            InitializeComponent();
            this.NeedPoint = true;
        }
        private string faultSignal = "0";//故障信号
        [CategoryAttribute("Data")]
        [Description("断路器故障信号，0为正常状态，1为故障状态")]
        public string FaultSignal
        {
            get { return faultSignal; }
            set { faultSignal = value; }

        }
        private string bol = "0";//接通信号
        [CategoryAttribute("Data")]
        [Description("断路器开断信号，0为打开状态，1为闭合状态")]
        public string Bol
        {
            get { return bol; }
            set { bol = value; }

        }
        private void duanluqi35kv_Paint(object sender, PaintEventArgs e)
        {
            Pen a = new Pen(Color.Yellow, 1);


            if (bol == "1")
            {
                SolidBrush b1 = new SolidBrush(Color.Green);
                //e.Graphics.DrawLine(a, x, 0, x, y * 2f);
                e.Graphics.DrawLine(a, x, 0, x, y * 0.5f);
                e.Graphics.FillRectangle(b1, x * 0.5f, y * 0.5f, x, y);
                e.Graphics.DrawLine(a, x, y * 1.5f, x, y * 2f);

            }
            if (bol == "0")
            {
                SolidBrush b1 = new SolidBrush(Color.Yellow);
                //e.Graphics.DrawLine(a, x, y * 2f, x, y * 1.1f);
                //e.Graphics.DrawLine(a, x,0, x, y * 0.85f);
                //e.Graphics.DrawLine(a, x * 0.6f, y * 0.85f, x, y * 1.1f);
                //Pen b = new Pen(Color.FromArgb(255, 0, 255, 0), 1);
                //e.Graphics.DrawLine(b, x * 0.85f, y * 0.8f, x * 1.15f, y * 0.9f);
                //e.Graphics.DrawLine(b, x * 0.85f, y * 0.9f, x * 1.15f, y * 0.8f);

                //e.Graphics.DrawLine(a, x, 0, x, y * 0.85f);
                //e.Graphics.DrawLine(a, x * 0.6f, y * 0.85f, x, y * 1.1f);
                //Pen b = new Pen(Color.FromArgb(255, 0, 255, 0), 1);
                //e.Graphics.DrawLine(b, x * 0.85f, y * 0.8f, x * 1.15f, y * 0.9f);
                //e.Graphics.DrawLine(b, x * 0.85f, y * 0.9f, x * 1.15f, y * 0.8f);
                e.Graphics.DrawLine(a, x, 0, x, y * 0.5f);
                e.Graphics.FillRectangle(b1, x * 0.5f, y * 0.5f, x, y);
                e.Graphics.DrawLine(a, x, y * 1.5f, x, y * 2f);

            }
            Pen c = new Pen(Color.White, 3);
            if (faultSignal == "1")
            {

                e.Graphics.DrawRectangle(c, x * 0.1f, y * 0.1f, x * 1.8f, y * 1.8f);

            }


        }

        private void duanluqi35kv_Resize(object sender, EventArgs e)
        {
            this.x = this.Width / 2;
            this.y = this.Height / 2;
            //this.Refresh();

        }

        private void duanluqi35kv_Load(object sender, EventArgs e)
        {
            duanluqi35kv_Resize(sender, e);
        }



    }
}